#ifndef _FIG_BULLET_MANAGER_H_
#define _FIG_BULLET_MANAGER_H_



#include "ui/ui_manager.h"
#include "fig_bullet.h"

class FIGBulletCollection;
class FIGBullet;
class FIGCraft;
class FIGLifeObj;


class FIGBulletManager
{

public:
	

	FIGBulletManager(
						FIGBullet::BULLET_TYPES Type, 
						int GroupCount, 
						float BulletFrequency,
						float DelayAfterBulletGroup,
						bool IsPlayer
						);

	

	void									Render(const math::Vec2& Offset,float Scale);
	void									RenderDebug(const math::Vec2& Offset,float Scale);
	void									Tick(float dt);
	void									ShootTick(
														FIGLifeObj* pShooter,
														const math::Vec2& ShootPos,
														float dt,
														const math::Vec2& TargetDir,
														FIGBullet::SHOOT_STYLES ShootStyle,
														int SoundSFXIndex
														);


	void									Clear();
	void									DieAll();
	FIGBullet*								Spawn(
													FIGLifeObj*	pShooter,
													const math::Vec2& Pos,
													FIGBullet::STARTPOS StartDir,
													const math::Vec2& TargetDir
													);

	int										GetCount() const;
	FIGBullet*								GetBulletByIndex(int Index);
	void									ShootToAllDir(const math::Vec2& Pos);
	

protected:

	FIGBullet*								ShootToDegree(FIGLifeObj* pShooter,const math::Vec2& Pos, float Degree);

	void									RomboShoot6(FIGLifeObj* pShooter, const math::Vec2& Pos);
	void									RomboShoot5(FIGLifeObj* pShooter, const math::Vec2& Pos);
	void									RomboShoot4(FIGLifeObj* pShooter, const math::Vec2& Pos);
	
	
	void									SpawnBulletsShapeTriangle(
																FIGLifeObj* pShooter,
																const math::Vec2& ShootPos,
																const math::Vec2& TargetDir																
																);

	void									SpawnBulletsShapeCircle(
																FIGLifeObj* pShooter,
																const math::Vec2& ShootPos,
																const math::Vec2& TargetDir																
																);

	int										m_GroupIndex;
	int										m_GroupCount;
	

	float									m_BulletFrequency;
	float									m_BulletDelayCounter;
	float									m_DelayAfterBulletGroup;
	float									m_GroupDelayCounter;
	FIGBullet::BULLET_TYPES					m_Type;
	FIGBullet::STARTPOS						m_StartingDir;
	
	std::vector<FIGBullet*>					m_Bullets;
	bool									m_IsPlayerCraft;

};

#endif